package com.qqtech.qquan.community.service;

import java.util.List;

import javax.annotation.Resource;

import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.stereotype.Service;

import com.qqtech.core.frame.dao.BaseDao;
import com.qqtech.core.frame.service.BaseServiceImpl;
import com.qqtech.qquan.community.dao.CommunityInfoDao;
import com.qqtech.qquan.community.model.CommunityInfo;
import com.qqtech.qquan.community.model.CommunityInfoQuery;
import com.qqtech.qquan.community.model.CommunityInfoVo;

@Service
public class CommunityInfoServiceImpl extends BaseServiceImpl<CommunityInfo> implements CommunityInfoService {
	public static final Logger log = LoggerFactory.getLogger(CommunityInfoServiceImpl.class);

	@Resource
	private CommunityInfoDao communityInfoDao;

	@Override
	protected BaseDao<CommunityInfo> getBaseDao() {
		return communityInfoDao;
	}

	@Override
	public int increasePv(Integer id) {
		return communityInfoDao.addPv(id);
	}

	@Override
	public List<CommunityInfoVo> queryRowNumList(CommunityInfoQuery query) {
		return communityInfoDao.queryRowNumList(query);
	}

	@Override
	public CommunityInfoVo getRowNumById(Integer id) {
		CommunityInfoQuery communityInfoQuery = new CommunityInfoQuery();
		communityInfoQuery.setId(id);
		List<CommunityInfoVo> list = communityInfoDao.queryRowNumList(communityInfoQuery);
		return list.size() > 0 ? list.get(0) : null;
	}

	@Override
	public CommunityInfoVo getRowNumByRowNum(Integer rowNum) {
		CommunityInfoQuery communityInfoQuery = new CommunityInfoQuery();
		communityInfoQuery.setRowNum(rowNum);
		List<CommunityInfoVo> list = communityInfoDao.queryRowNumList(communityInfoQuery);
		return list.size() > 0 ? list.get(0) : null;
	}

}